<%--
  Created by IntelliJ IDEA.
  User: 张峰华
  Date: 2021/12/26
  Time: 20:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="../layui/layui.js"></script>
    <link rel="stylesheet" href="../layui/css/layui.css">
    <script type="text/javascript">
        layui.use('table', function(){
            var table = layui.table;
            table.init("demo",{
                // height:500,
                // cellMinWidth: 80,
                page:true,  //开启分页
                limit:3,     //每页展示多少条
                limits:[3,4,5,6],
                toolbar:true,//开启头部工具栏，打印导出，筛选查看
            });
        });
    </script>
</head>
<body>
<button type="button" class="btn btn-primary"  onclick="toadd()">添加人员</button>
        <table lay-filter="demo" class="layui-table">
        <thead>
        <tr>
            <th lay-data="{type: 'checkbox', fixed: 'left'}"></th>
            <th lay-data="{field:'pid',sort:true}">编号</th>
            <th lay-data="{field:'pname'}">姓名</th>
            <th lay-data="{field:'age'}">年龄</th>
            <th lay-data="{field:'sex',templet:'#sexTpl'}">性别</th>
            <th lay-data="{field:'pgroup'}">组别</th>
            <th lay-data="{field:'pposition'}">职位</th>
            <th lay-data="{field:'entry_days'}">入职天数</th>
            <th lay-data="{field:'del'}">操作</th>
            <th lay-data="{field:'update'}">修改</th>
<%--            <th>修改</th>--%>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${requestScope.personnels}" var="x">
            <tr>
                <td></td>
                <td>${x.pid}</td>
                <td>${x.pname}</td>
                <td>${x.age}</td>
                <td>${x.sex}</td>
                <td>${x.pgroup}</td>
                <td>${x.pposition}</td>
                <td>${x.entry_days}</td>
                <td><a href="javascript:del('${x.pid}')">删除</a></td>
                <td><a onclick="toUpdate()" href="javascript:toupdate('${x.pid}')">修改</a></td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
<script type="text/html" id="sexTpl">
    {{#  if(d.sex === '男'){ }}
    <span style="color: #00aced;">{{ d.sex }}</span>
    {{#  } else { }}
    {{ d.sex }}
    {{#  } }}
</script>
</body>

</html>
